Optimal. Leaf size=83 \[ -\frac{1}{4} (a-b) \log \left (x^2-x+1\right )+\frac{1}{4} (a-b) \log \left (x^2+x+1\right )-\frac{(a+b) \tan ^{-1}\left (\frac{1-2 x}{\sqrt{3}}\right )}{2 \sqrt{3}}+\frac{(a+b) \tan ^{-1}\left (\frac{2 x+1}{\sqrt{3}}\right )}{2 \sqrt{3}} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0548068, antiderivative size = 83, normalized size of antiderivative = 1., number of steps used = 9, number of rules used = 5, integrand size = 18, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.278, Rules used = {1169, 634, 618, 204, 628} \[ -\frac{1}{4} (a-b) \log \left (x^2-x+1\right )+\frac{1}{4} (a-b) \log \left (x^2+x+1\right )-\frac{(a+b) \tan ^{-1}\left (\frac{1-2 x}{\sqrt{3}}\right )}{2 \sqrt{3}}+\frac{(a+b) \tan ^{-1}\left (\frac{2 x+1}{\sqrt{3}}\right )}{2 \sqrt{3}} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 1169
Rule 634
Rule 618
Rule 204
Rule 628
Rubi steps
\begin{align*} \int \frac{a+b x^2}{1+x^2+x^4} \, dx &=\frac{1}{2} \int \frac{a-(a-b) x}{1-x+x^2} \, dx+\frac{1}{2} \int \frac{a+(a-b) x}{1+x+x^2} \, dx\\ &=\frac{1}{4} (a-b) \int \frac{1+2 x}{1+x+x^2} \, dx+\frac{1}{4} (-a+b) \int \frac{-1+2 x}{1-x+x^2} \, dx+\frac{1}{4} (a+b) \int \frac{1}{1-x+x^2} \, dx+\frac{1}{4} (a+b) \int \frac{1}{1+x+x^2} \, dx\\ &=-\frac{1}{4} (a-b) \log \left (1-x+x^2\right )+\frac{1}{4} (a-b) \log \left (1+x+x^2\right )+\frac{1}{2} (-a-b) \operatorname{Subst}\left (\int \frac{1}{-3-x^2} \, dx,x,-1+2 x\right )+\frac{1}{2} (-a-b) \operatorname{Subst}\left (\int \frac{1}{-3-x^2} \, dx,x,1+2 x\right )\\ &=-\frac{(a+b) \tan ^{-1}\left (\frac{1-2 x}{\sqrt{3}}\right )}{2 \sqrt{3}}+\frac{(a+b) \tan ^{-1}\left (\frac{1+2 x}{\sqrt{3}}\right )}{2 \sqrt{3}}-\frac{1}{4} (a-b) \log \left (1-x+x^2\right )+\frac{1}{4} (a-b) \log \left (1+x+x^2\right )\\ \end{align*}
Mathematica [C] time = 0.1246, size = 97, normalized size = 1.17 \[ \frac{\left (2 i a+\left (\sqrt{3}-i\right ) b\right ) \tan ^{-1}\left (\frac{1}{2} \left (\sqrt{3}-i\right ) x\right )}{\sqrt{6+6 i \sqrt{3}}}+\frac{\left (\left (\sqrt{3}+i\right ) b-2 i a\right ) \tan ^{-1}\left (\frac{1}{2} \left (\sqrt{3}+i\right ) x\right )}{\sqrt{6-6 i \sqrt{3}}} \]
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.047, size = 114, normalized size = 1.4 \begin{align*} -{\frac{\ln \left ({x}^{2}-x+1 \right ) a}{4}}+{\frac{\ln \left ({x}^{2}-x+1 \right ) b}{4}}+{\frac{a\sqrt{3}}{6}\arctan \left ({\frac{ \left ( 2\,x-1 \right ) \sqrt{3}}{3}} \right ) }+{\frac{\sqrt{3}b}{6}\arctan \left ({\frac{ \left ( 2\,x-1 \right ) \sqrt{3}}{3}} \right ) }+{\frac{\ln \left ({x}^{2}+x+1 \right ) a}{4}}-{\frac{\ln \left ({x}^{2}+x+1 \right ) b}{4}}+{\frac{a\sqrt{3}}{6}\arctan \left ({\frac{ \left ( 1+2\,x \right ) \sqrt{3}}{3}} \right ) }+{\frac{\sqrt{3}b}{6}\arctan \left ({\frac{ \left ( 1+2\,x \right ) \sqrt{3}}{3}} \right ) } \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.4756, size = 93, normalized size = 1.12 \begin{align*} \frac{1}{6} \, \sqrt{3}{\left (a + b\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x + 1\right )}\right ) + \frac{1}{6} \, \sqrt{3}{\left (a + b\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x - 1\right )}\right ) + \frac{1}{4} \,{\left (a - b\right )} \log \left (x^{2} + x + 1\right ) - \frac{1}{4} \,{\left (a - b\right )} \log \left (x^{2} - x + 1\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.39857, size = 223, normalized size = 2.69 \begin{align*} \frac{1}{6} \, \sqrt{3}{\left (a + b\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x + 1\right )}\right ) + \frac{1}{6} \, \sqrt{3}{\left (a + b\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x - 1\right )}\right ) + \frac{1}{4} \,{\left (a - b\right )} \log \left (x^{2} + x + 1\right ) - \frac{1}{4} \,{\left (a - b\right )} \log \left (x^{2} - x + 1\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [C] time = 0.885689, size = 740, normalized size = 8.92 \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.12958, size = 93, normalized size = 1.12 \begin{align*} \frac{1}{6} \, \sqrt{3}{\left (a + b\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x + 1\right )}\right ) + \frac{1}{6} \, \sqrt{3}{\left (a + b\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x - 1\right )}\right ) + \frac{1}{4} \,{\left (a - b\right )} \log \left (x^{2} + x + 1\right ) - \frac{1}{4} \,{\left (a - b\right )} \log \left (x^{2} - x + 1\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]